import request from '@/http/request'
// 查询卡劵列表接口

export const $getCouponList = (params:any) => {
    return request.request({
      url: '/api/award/coupon',
      method: 'get',
      params: params
    })
  }
// 查询卡劵详情

export const $getCouponDetail = (params:any) => {
    return request.request({
      url: '/api/award/coupon/details',
      method: 'get',
      params: params
    })
  }

  // 查询卡卷setting配置的详情
export const $settingDetail = (params:any) => {
    return request.request({
      url: '/api/award/setting/detail',
      method: 'get',
      params: params
    })
  }


// 更改卡劵状态
export const $couponState = (data:any) => {
    return request.request({
      url: '/api/award/coupon/state',
      method: 'put',
      data: data
    })
  }
// 更改卡卷为草稿状态
export const $couponDraft = (data:any) => {
    return request.request({
      url: '/api/award/coupon/updateToDraft',
      method: 'put',
      data: data
    })
  }

  // 删除卡券奖品
  export function $couponDelete(couponId:any) {
    return request.request({
      url: '/api/award/coupon',
      method: 'delete',
      params: { couponId }
    })
  }

  // 卡券奖品添加单个商户导入
  export function $couponAddAwardMch(data:any) {
    return request.request({
      url: '/api/award/mch/addAwardMch',
      method: 'post',
      data: data
    })
  }

  /* 机构列表 */
  export function $queryOrgTree(agentNo) {
    return request.request({
      url: '/api/subList/queryOrgTree',
      method: 'get',
      params: agentNo
    })
  }

  // 新增卡券奖品（post）和修改卡券奖品详情信息（put）
  export function $couponAddOrEdit(method,data) {
    return request.request({
      url: '/api/award/coupon',
      method,
      data,
    })
  }


 // 新增卡券奖品（post）和修改卡券奖品详情信息（put）
  export function $addStting(data) {
    return request.request({
      url: '/api/award/setting/add',
       method: 'post',
        data,
    })
  }

 // 新增卡券奖品（post）和修改卡券奖品详情信息（put）
  export function $updateStting(data) {
    return request.request({
      url: '/api/award/setting/update',
       method: 'post',
        data,
    })
  }

  // 获取可核销商户列表
  export function $getMchList(data:any) {
    return request.request({
      url: '/api/award/mch/getMchDestroyList',
      method: 'post',
      data: data
    })
  }

  // 导入可核销商户
  export function $couponImportMch(data:any) {
    return request.request({
      url: '/api/award/mch/importMchDestroyFile',
      method: 'post',
      data: data
    })
  }

  // 删除导入可核销商户
  export function $couponDeleteMch(data:any) {
    return request.request({
      url: '/api/award/mch/deleteMchDestroy',
      method: 'post',
      data: data
    })
  }

  // 删除卡券所有可核销商户
  export function $couponDeleteAllMch(data:any) {
    return request.request({
      url: '/api/award/mch/removeAllMchDestroy',
      method: 'post',
      data: data
    })
  }

  // 新增或修改活动奖品
  // 新增奖品分配给机构 新增(POST) 修改(PUT) 删除(DELETE)
  export function $activityAwardAgentAddOrEdit(method:any,data:any) {
    return request.request({
      url: '/api/activity/award/agent',
      method,
      data,
    })
  }

  // 新增单个派发人员
  export function $addAgent(data:any) {
    return request.request({
      url: '/api/award/employee/addAllocationUser',
      method: 'post',
      data: data
    })
  }

// 上传可派发名单
export function $uploadAllocationUser(data:any) {
  return request.request({
    url: '/api/award/employee/addAllocationUserFile',
    method: 'post',
    data: data
  })
}

// 删除可派发名单
export function $deleteAllocationUser(data:any) {
  return request.request({
    url: '/api/award/employee/deleteAllocationUserFile',
    method: 'post',
    data: data
  })
}
// 删除所有可派发名单
export function $deleteAllAllocationUser(data:any) {
  return request.request({
    url: '/api/award/employee/deleteAllAllocationUser',
    method: 'post',
    data: data
  })
}

// 获取可派发名单
export function $getAllocationUser(data:any) {
  return request.request({
    url: '/api/award/employee/getAllocationUserList',
    method: 'post',
    data: data
  })
}

// 配置可派发人员
export function $configAllocationUser(data:any) {
  return request.request({
    url: '/api/award/setting/updateIsAllocationUser',
    method: 'post',
    data: data
  })
}

// 更新可派发机构是否限制
export function $configAllocation(data:any) {
  return request.request({
    url: '/api/award/setting/updateIsAllocation',
    method: 'post',
    data: data
  })
}

// 新增or修改满减随机减卡券
export  function $couponFullRandomAddOrEdit(url:any,data:any) {
    return request.request({
        url: url,
        method: 'post',
        data: data
      })
  }

  // 出资方下拉列表
  export function $getContributorList(params:any) {
    return request.request({
      url: '/api/pay/auth',
      method: 'get',
      params: params
    })
  }
// 修改可核销商户渠道码的状态
export function $updateMchDestroyState(data:any) {
  return request.request({
    url: '/api/award/mch/updateMchDestroyChannelDisplay',
    method: 'post',
    data: data
  })
}
// 修改人员渠道码状态
export function $updateEmployeeState(data:any) {
  return request.request({
    url: '/api/award/employee/updateEmpChannelDisplay',
    method: 'post',
    data: data
  })
}

// 新增单个派发机构
export function $addAgentOrg(data:any) {
  return request.request({
    url: '/api/activity/award/agent/addOne',
    method: 'post',
    data: data
  })
}

// 获取活动奖品分配机构列表
export function $getActivityAwardAgentList(data:any) {
  return request.request({
    url: '/api/activity/award/agent',
    method: 'get',
    params: data
  })
}

// 删除所有可以派发机构
export function $deleteAllActivityAwardAgent(data:any) {
  return request.request({
    url: '/api/activity/award/agent/removeAll',
    method: 'post',
    data: data
  })
}

// 删除单个可以派发机构
export function $deleteActivityAwardAgent(data:any) {
  return request.request({
    url: '/api/activity/award/agent/removeOne',
    method: 'post',
    data: data
  })
}

// 上传可派发机构名单
export function $uploadActivityAwardAgent(data:any) {
  return request.request({
    url: '/api/activity/award/agent/importExcelToAdd',
    method: 'post',
    data: data
  })
}
// 更新可派发机构名单状态
export function $updateActivityAwardAgentState(data:any) {
  return request.request({
    url: '/api/activity/award/agent/updateChannelDisplay',
    method: 'post',
    data: data
  })
}